home *** CD-ROM | disk | FTP | other *** search
/ Experimental BBS Explossion 3 / Experimental BBS Explossion III.iso / c / pcl4c40.zip / PCL4C.USR < prev    next >
Text File  |  1993-10-25  |  82KB  |  2,041 lines

  1.  
  2.  
  3.                           Personal Communications Library
  4.  
  5.                                 For the C Language
  6.  
  7.  
  8.                                     (PCL4C)
  9.  
  10.  
  11.  
  12.                                  USERS MANUAL
  13.  
  14.  
  15.  
  16.  
  17.  
  18.                                   Version  4.0
  19.  
  20.                                   Oct 18, 1993
  21.  
  22.  
  23.  
  24.  
  25.                         This software is provided as-is.
  26.                  There are no warranties, expressed or implied.
  27.  
  28.  
  29.  
  30.  
  31.                               Copyright (C) 1993
  32.                               All rights reserved
  33.  
  34.  
  35.  
  36.                               MarshallSoft Computing, Inc.
  37.                               Post Office Box 4543
  38.                               Huntsville AL 35815
  39.  
  40.                               Voice 205-881-4630
  41.                               FAX   205-881-4630
  42.                               BBS   205-880-9748
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.         PCL4C Users Manual                                     Page 1
  61.                               C O N T E N T S
  62.  
  63.  
  64.  
  65.  
  66.  
  67.          Chapter                                                   Page
  68.  
  69.          1.0 Introduction................................................3
  70.              1.1 User Support............................................4
  71.              1.2 A Typical Application...................................5
  72.              1.3 Installation............................................6
  73.          2.0 Library Organization........................................7
  74.              2.1 Configuration...........................................7
  75.              2.2 Initialization & Termination............................7
  76.              2.3 Modem Control & Status..................................8
  77.              2.4 Serial I/O..............................................8
  78.              2.5 Error Detection.........................................9
  79.              2.6 General Support.........................................9
  80.          3.0 Library Overview...........................................10
  81.              3.1 Memory Models..........................................10
  82.              3.2 Compilers Supported....................................11
  83.              3.3 Using the Library......................................12
  84.              3.4 Example Programs.......................................12
  85.              3.5 Compiling & Linking....................................13
  86.          4.0 Talking to Your Modem......................................14
  87.              4.1 Modem Standards........................................14
  88.              4.2 Flow Control...........................................15
  89.              4.3 Modem Initialization...................................16
  90.          5.0 Problems...................................................17
  91.          6.0 Serial Communications......................................18
  92.              6.1 Communications Basics..................................18
  93.              6.2 Standard Port Addresses................................19
  94.              6.3 Running 3 or 4 Ports Concurrently......................20
  95.              6.4 Using the DigiBoard....................................21
  96.              6.5 Transmitter Interrupts.................................22
  97.              6.6 RS232 Signals..........................................23
  98.              6.7 National INS8250, INS16450, and INS16550 UARTs.........24
  99.              6.8 Register Summary.......................................25
  100.          7.0 Terminal Emulator Program (TERM)...........................27
  101.          8.0 Legal Issues...............................................28
  102.              8.1 Registration...........................................28
  103.              8.2 Referral Program.......................................28
  104.              8.3 License................................................29
  105.              8.4 Warranty...............................................29
  106.          9.0 Summary....................................................30
  107.              9.1 Revision History.......................................30
  108.              9.2 Function Summary.......................................32
  109.              9.3 Further Reading........................................32
  110.         10.0 Other MarshallSoft Computing products for C................33
  111.              10.1 The Personal Protocol Library for C...................33
  112.              10.2 The LZW Data Compression Library for C................33
  113.              10.3 The EMS Expanded Memory Library for C.................34
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.         PCL4C Users Manual                                     Page 2
  121.          1.0 Introduction
  122.  
  123.  
  124.          The Personal Communications Library for the C Language (PCL4C)  is
  125.          an  asynchronous  communications  library designed for experienced
  126.          software  developers  programming  in  C.   Five   compilers   are
  127.          supported: Microsoft C, Quick C, Borland C, Turbo C, and MIX Power
  128.          C.  An IBM PC/XT/AT or compatible is required.  The PCL features:
  129.  
  130.          o SMALL, COMPACT, MEDIUM, and LARGE memory models.
  131.          o 37 communications and support functions.
  132.          o Supports the high performance INS16550 UART.
  133.          o Supports the PC/4 and PC/8 DigiBoard.
  134.          o Supports hardware (RTS/CTS) flow control.
  135.          o Interrupt driven receiver & (optionally) transmitter.
  136.          o Supports 300 baud to 115,200 baud.
  137.          o Supports COM1 through COM4 (through COM10 with DigiBoard).
  138.          o Adjustable receive queues from 8 bytes to 32 KB.
  139.          o Control-BREAK error exit.
  140.          o 18 communications error conditions trapped.
  141.          o Allows 4 ports to run concurrently (10 with DigiBoard).
  142.          o Complete modem control & status.
  143.          o Written in assembly language for small size & high speed.
  144.          o Terminal program featuring ASCII (with XON/XOFF), XMODEM,
  145.            YMODEM, & YMODEM-G.
  146.  
  147.          Why should you buy PCL4C ? I can give you several good reasons.
  148.  
  149.            COMPLETE - PCL4C is complete since it provides absolute control
  150.                       of the serial ports (including the high  performance
  151.                       INS16550).
  152.  
  153.             COMPACT - PCL4C  is  very compact  at  less  than  6  KB. Your
  154.                       application doesn't carry a lot of excess code.
  155.  
  156.                FAST - PCL4C is fast since it will  run  at  38400  baud  on
  157.                       even  slow  8088 PCs (4.77 MHZ) and at 115200 baud on
  158.                       most everything else.
  159.  
  160.             SUPPORT - If you get stuck,  you talk  to  the programmer  that
  161.                       wrote the code, not a  person  hired  to  answer  the
  162.                       phone.
  163.  
  164.                 BBS - A BBS is available (2400 to 9600 baud, N81) in  order
  165.                       to provide immediate support as necessary.
  166.  
  167.          NEWSLETTER - One  year  subscription  to  the  MSC  newsletter
  168.                       discusses communications  problems  and  solutions
  169.                       (published quarterly).
  170.  
  171.               PRICE - You get PCL4C for a very reasonable price !
  172.  
  173.            UPGRADES - Once you buy PCL4C, you can always update to  the  most
  174.                       recent  version  for  little  more  than  the  cost  of
  175.                       sending it out to you.
  176.  
  177.  
  178.  
  179.  
  180.         PCL4C Users Manual                                     Page 3
  181.          1.1 User Support
  182.  
  183.  
  184.          We want you to be successful in developing your applications using
  185.          PCL4C!  We depend on our customers to let us know what  they  need
  186.          in  a  communications  library.   This  means  we are committed to
  187.          providing the best communications library that we can. If you have
  188.          any suggestions or comments, please let us know.
  189.  
  190.          If you are having a problem using PCL4C, call us  at  205-881-4630
  191.          between  5  PM  and 9 PM CST Monday through Saturday, or FAX us at
  192.          the same telephone number at any time (24 hours).   You  can  also
  193.          call at other times and leave a message, and call back later for a
  194.          reply. However, we can only answer questions with respect to using
  195.          the PCL4C library.  We cannot help you program your application.
  196.  
  197.          You  may  also  call  our  User Support BBS (2400 to 9600 baud, no
  198.          parity, 8 data bits, 1 stop  bit)  at  205-880-9748  and  leave  a
  199.          message  (address  it to the SYSOP).  We will usually have a reply
  200.          ready for you within 24 hours.
  201.  
  202.          The  BBS  is available 24 hours per day except at 2 PM Sundays for
  203.          maintenanace. All files are in standard ZIP format. The  BBS  will
  204.          contain  the latest shareware version of all MarshallSoft products
  205.          as well as related files such as:
  206.  
  207.              BUGS.ZIP  --  Bug report.
  208.              NEWS.ZIP  --  Latest news regarding our products.
  209.  
  210.          The  MarshallSoft  Computing,  Inc.   newsletter  "Comm  Talk"  is
  211.          published quarterly.  It discusses various communications problems
  212.          and   solutions  using  PCL4C  as  well  as  related  information.
  213.          Registered users receive a  one  year  complimentary  subscription
  214.          when first registering and for each update purchased.
  215.  
  216.          Of  course, you can always write to us. You should receive a reply
  217.          within a week or so.
  218.  
  219.  
  220.  
  221.  
  222.  
  223.  
  224.  
  225.  
  226.  
  227.  
  228.  
  229.  
  230.  
  231.  
  232.  
  233.  
  234.  
  235.  
  236.  
  237.  
  238.  
  239.  
  240.         PCL4C Users Manual                                     Page 4
  241.          1.2 A Typical Application
  242.  
  243.  
  244.          In  general,  there  are  two  classes  of applications that use a
  245.          communications library like PCL4C -- those that  use  a  modem  to
  246.          connect  to the outside world and those that connect directly to a
  247.          peripheral device. In either case, a typical  application  program
  248.          using PCL4C might look like the following code outline:
  249.  
  250.  
  251.  
  252.          *****************************************************
  253.          * #include  "pcl4c.h"                               *
  254.          *                                                   *
  255.          * char Buffer[1024];                                *
  256.          * main()                                            *
  257.          * {/* initialize serial comm  system  */            *
  258.          *  SioRxBuf(Port,Buffer,Size1024);                  *
  259.          *  SioParms(Port,NoParity,OneStopBit,WordLength8);  *
  260.          *  SioReset(Port,Baud2400);                         *
  261.          *                                                   *
  262.          *  ...application code...                           *
  263.          *                                                   *
  264.          *  /*  terminate  serial  comm  system  */          *
  265.          *  SioDone(Port);                                   *
  266.          * }                                                 *
  267.          *****************************************************
  268.  
  269.  
  270.  
  271.          In the above example, SioRxBuf is called to set up the a 1024 byte
  272.          receive  buffer; SioParms is called to set up the parity, stop bit
  273.          count, and word length; SioReset is called to set the baud rate to
  274.          2400  and  reset  the  UART  (Univeral  Asynchronous  Receiver   /
  275.          Transmitter).
  276.  
  277.          Before  leaving your application, SioDone is called to restore the
  278.          prior state of the serial communications system.
  279.  
  280.          If  you  are  using  a  modem, you also need to be concerned about
  281.          initializing your modem correctly and handling any  required  flow
  282.          control. Refer to the "Talking to Your Modem" chapter for detailed
  283.          information.
  284.  
  285.          If you are using the versions  of  the  library  with  transmitter
  286.          interrupts  enabled (PCL4C_S2.LIB, PCL4C_M2.LIB, PCL4C_C2.LIB, and
  287.          PCL4C_L2.LIB), then SioTxBuf()  must  be  called  to  set  up  the
  288.          transmitter buffer.
  289.  
  290.  
  291.  
  292.  
  293.  
  294.  
  295.  
  296.  
  297.  
  298.  
  299.  
  300.         PCL4C Users Manual                                     Page 5
  301.          1.3 Installation
  302.  
  303.  
  304.          (1) Before installation of PCL4C , your C compiler should  already
  305.          be  installed  on  your system and tested. If you are not familiar
  306.          with makefiles, refer to your compiler manual. If  you  are  using
  307.          the  interactive  environment  for  Quick C or Turbo C, be sure to
  308.          compile with the memory model corresponding to the  PCL4C  library
  309.          used, and include the correct library in the project file. Examine
  310.          the file "FILES.LST" for a list of all the distribution files.
  311.  
  312.          (2) Make a backup  copy  of  your  distribution  disk.   Put  your
  313.          original distribution disk in a safe place.
  314.  
  315.          (3)  Create  a  work  directory  on  your work disk (normally your
  316.          harddisk). For example, to create a work directory named PCL4C, we
  317.          first log onto the work disk and then type:
  318.  
  319.                                MKDIR PCL4C
  320.  
  321.          (4)  Copy  all the files from your backup copy of the distribution
  322.          disk to your work directory.  For example, to  copy  from  the  A:
  323.          drive to your work directory, we type:
  324.  
  325.                               CD PCL4C
  326.                               COPY A:*.*
  327.  
  328.          (5) [OPTIONAL] Delete the makefiles  that  you  won't  need.   For
  329.          example,  if  you  use  the Microsoft C compiler, then you want to
  330.          keep all makefiles ending *._M_ but can delete those for  Turbo  C
  331.          (*._T_), Quick C (*._Q_), and MIX Power C (X_*.BAT).  You may also
  332.          delete any libraries that you won't need.
  333.  
  334.          (6)  Compile  SIMPLE.C and link with the appropriate PCL4C library
  335.          (PCL4C_S.LIB for all but Power  C  which  must  use  PCL4C_S.MIX).
  336.          Makefiles  (or  project  files)  are  provided  for  each  of  the
  337.          supported compilers (Borland C & Turbo C use the same makefiles).
  338.  
  339.              a) Microsoft C: Type  MAKE SIMPLE._M_
  340.  
  341.              b) Microsoft Quick C: Type  MAKE SIMPLE._Q_
  342.  
  343.              c) Borland & Turbo C: Type  MAKE -FSIMPLE._T_
  344.  
  345.              d) MIX Power C: Type X_SIMPLE
  346.  
  347.          SIMPLE.C  should  compile without any problems as all example code
  348.          has been tested with each of the supported compilers.
  349.  
  350.          (7) The recommended way to  test  SIMPLE  is  to  run  it  on  two
  351.          computers  connected  by a null modem cable.  Whatever is typed on
  352.          one computer should be displayed on the other.
  353.  
  354.  
  355.  
  356.  
  357.  
  358.  
  359.  
  360.         PCL4C Users Manual                                     Page 6
  361.          2.0 Library Organization
  362.  
  363.  
  364.          The  PCL4C  library is organized into six categories of functions.
  365.          Refer to the PCL  Reference  Manual  (PCL4C.REF)  for  details  on
  366.          individual functions.
  367.  
  368.  
  369.          2.1 Configuration
  370.  
  371.  
  372.          There are three functions in the configuration category.  SioPorts
  373.          sets  the  number  of  PC and DigiBoard ports.  SioUART is used to
  374.          change the UART base  address  for  a  communications  port  to  a
  375.          non-standard address, while SioIRQ is used to assign a nonstandard
  376.          IRQ line to a port.  (See the chapter IBM Communications Ports for
  377.          more details on standard UART addresses and IRQ lines).
  378.  
  379.          The  configuration  functions SioPorts, SioUART and SioIRQ must be
  380.          called before  calling  any  other  library  functions.   Be  very
  381.          careful  in  using  these  functions.   Remember  that your serial
  382.          hardware must support the UART and IRQ that you  specify.   Always
  383.          test any new configuration immediately.
  384.  
  385.          SioPorts -- Sets number of PC and DigiBoard ports.
  386.          SioUART  -- Sets the UART base address.
  387.          SioIRQ   -- Assigns an IRQ line to a port.
  388.  
  389.          THE IRQ GOLDEN RULE: You may open (via SioReset) only one port per
  390.          IRQ (except for the DigiBoard).
  391.  
  392.  
  393.          2.2 Initialization & Termination
  394.  
  395.  
  396.          There  are  eight  functions in the initialization and termination
  397.          category.  Together, SioParms, SioFIFO,  SioRxBuf,  SioTxBuf,  and
  398.          SioReset  initialize  your  serial  communications  system.   Your
  399.          application  must  call  SioParms  and  SioRxBuf  before   calling
  400.          SioReset,  and  SioReset  must  be  called  before  any serial I/O
  401.          processing can be done.
  402.  
  403.          After initialization, SioParms and SioBaud can be called again  to
  404.          change  the communications parameters without resetting the serial
  405.          port. SioFlow can be called to enable hardware flow control.
  406.  
  407.          Before exiting from your  application,  SioDone  must  be  called.
  408.          Failure to call SioDone can crash your system later.
  409.  
  410.          SioRxBuf   -- Sets up receive buffer.
  411.          SioTxBuf   -- Sets up transmitter buffer.
  412.          SioFIFO    -- Sets the interrupt level for the INS16550.
  413.          SioParms   -- Sets parity, stop bits, and word length.
  414.          SioReset   -- Initialize a serial port for processing.
  415.          SioDone    -- Terminates further serial processing.
  416.          SioBaud    -- Sets the baud rate of the selected port.
  417.          SioFlow    -- Enables / disables flow control.
  418.  
  419.  
  420.         PCL4C Users Manual                                     Page 7
  421.          2.3 Modem Control & Status
  422.  
  423.  
  424.          There are eight functions in the modem control and status category
  425.          which  provide  your  application  with  complete control over the
  426.          status and control bits of your modem.
  427.  
  428.          There are two modem control bits, "Data Terminal Ready" (DTR)  and
  429.          "Request  To  Send" (RTS). These bits can be read, set, or cleared
  430.          by SioDTR and SioRTS.
  431.  
  432.          There are four modem status bits, "Data Set Ready"  (DSR),  "Clear
  433.          To  Send"  (CTS), "Ring Indicator" (RI), and "Data Carrier Detect"
  434.          (DCD). SioModem can read any of the  modem  status  bits.  SioDSR,
  435.          SioCTS,  SioRI,  and  SioDCD  can only read their respective modem
  436.          status bit.
  437.  
  438.          Refer to the chapter entitled "RS232 Signals" for a discussion  of
  439.          each of the control and status bits.
  440.  
  441.          SioDTR    -- Set, clear, or read the Data Terminal Ready (DTR) bit.
  442.          SioRTS    -- Sets, clears, or reads the Request to Send (RTS) line.
  443.          SioModem  -- Reads the modem status register.
  444.          SioDSR    -- Reads the Data Set Ready (DSR) modem status bit.
  445.          SioCTS    -- Reads the Clear to Send (CTS) modem status bit
  446.          SioDCD    -- Reads the Data Carrier Detect (DCD) modem status bit.
  447.          SioRI     -- Reads the Ring Indicator (RI) modem status bit.
  448.          SioRead   -- Reads the contents of the 7 UART registers.
  449.  
  450.  
  451.          2.4 Serial I/O
  452.  
  453.  
  454.          There are eight library  functions  in  the  serial  I/O  category.
  455.          Together,  these  functions  give  the programmer complete control
  456.          over serial I/O.  Higher level functions  such  as  protocols  and
  457.          smart  modem communications can be completely implemented in terms
  458.          of these functions. Refer to the example code.
  459.  
  460.          SioGetc  and SioPutc perform all the actual serial I/O.  SioUnGetc
  461.          "ungets" the last serial byte read. SioRxFlush clears the  receive
  462.          queue  while  SioTxFlush clears the transmit queue. SioLine can be
  463.          used to test for UART  errors.  SioRxQue  returns  the  number  of
  464.          bytes  in  the  receive queue while SioTxQue returns the number of
  465.          bytes in the transmit queue.
  466.  
  467.          SioGetc    -- Reads the next character from the serial line.
  468.          SioPutc    -- Transmit a character over a serial line.
  469.          SioUnGetc  -- "Un-gets" (puts back) a specified character.
  470.          SioRxFlush -- Flush (clears) the receive buffer.
  471.          SioRxQue   -- Returns the number of characters in the RX queue.
  472.          SioTxFlush -- Flush (clears) the transmit buffer.
  473.          SioTxQue   -- Returns the number of characters in the TX queue.
  474.          SioLine    -- Reads the line status register.
  475.  
  476.  
  477.  
  478.  
  479.  
  480.         PCL4C Users Manual                                     Page 8
  481.          2.5  Error Detection
  482.  
  483.  
  484.          There are four functions in the error detection category. They are
  485.          concerned with detecting or reporting communications errors.   Use
  486.          of  these  functions  can make your application significantly more
  487.          robust.
  488.  
  489.          SioBrkKey   can   be   used  as  an  "emergency"  exit  from  your
  490.          application. SioBrkSig can read or modify the UART break bit. This
  491.          is useful for signalling the remote system that a fatal  condition
  492.          has  occurred.  SioLoopBack  can  be used to test the integrity of
  493.          your UART.  SioError displays a error message corresponding to  an
  494.          error  code  returned  from a PCL4C function (every PCL4C function
  495.          returns a code).
  496.  
  497.          SioBrkKey -- Returns non-zero if the Control-BREAK key was pressed
  498.          SioBrkSig -- Asserts, cancels, or detects the RS232 BREAK  signal.
  499.          SioError  -- Displays  error  in  text.
  500.          SioLoopBack -- Performs a UART loopback test.
  501.  
  502.  
  503.          2.6 General Support
  504.  
  505.  
  506.          There are six functions in the general support category.  Strictly
  507.          speaking, they are not communications functions but  are  provided
  508.          in  the  PCL4C  library  because  they  are  not  always available
  509.          (especially in some older compiler run-time  libraries).   At  any
  510.          rate,  they  take  up  a  very  small amount of additional memory.
  511.          Registered users can also remove these functions from the  library
  512.          if needed.
  513.  
  514.          SioInfo     -- Returns the library version & memory model.
  515.          SioCrtWrite -- Write character to the screen.
  516.          SioDelay    -- Delays one or more tics (18.2 tics per second).
  517.          SioKeyPress -- Detects if keyboard key has been pressed.
  518.          SioKeyRead  -- Reads the keyboard.
  519.          SioTimer    -- Returns the number of system clock tics.
  520.  
  521.  
  522.  
  523.  
  524.  
  525.  
  526.  
  527.  
  528.  
  529.  
  530.  
  531.  
  532.  
  533.  
  534.  
  535.  
  536.  
  537.  
  538.  
  539.  
  540.         PCL4C Users Manual                                     Page 9
  541.          3.0 Library Organization
  542.  
  543.  
  544.          3.1 Memory Models
  545.  
  546.  
  547.          Because of the segmented architecture of the INTEL CPU, there  are
  548.          four  memory  organizations possible for computer programs.  These
  549.          are named the SMALL, COMPACT, MEDIUM,  and  LARGE  memory  models,
  550.          which  correspond  to  the  four  combinations of "near" and "far"
  551.          addresses for code and data.
  552.  
  553.          Each  executable  is  composed of one or more segments, where each
  554.          segment can occupy from one byte to 64  KB  of  memory.  A  "near"
  555.          address  is  a 16 bit offset in a segment, whereas a "far" address
  556.          consists of both a 16 bit segment value and a 16 bit offset.
  557.  
  558.          In  the small memory model, code and data each occupy one segment.
  559.          Thus, near addresses are allocated for both code and data.
  560.  
  561.          In  the compact memory model, code occupies one segment while data
  562.          may occupy multiple segments. Near  addresses  are  allocated  for
  563.          code but far addresses are allocated for data.
  564.  
  565.          In  the  medium memory model, data occupies one segment while code
  566.          may occupy multiple segments. Near  addresses  are  allocated  for
  567.          data but far addresses are allocated for code.
  568.  
  569.          In the large memory model, data  and  code  each  occupy  multiple
  570.          segments.  Far  addesses  are  allocated  for  both code and data.
  571.          Thus, both code and data can use as many segments as required.
  572.  
  573.          Refer to your compiler manual  for  a  discussion  of  the  memory
  574.          models supported by your compiler.
  575.  
  576.          PCL4C  is  organized  as  four  separate  libraries  (PCL4C_S.LIB,
  577.          PCL4C_C.LIB, PCL4C_M.LIB and  PCL4C_L.LIB)  corresponding  to  the
  578.          four  standard  memory  models.  For the MIX Power C compiler, the
  579.          small,  medium,  and  large  models  are  provided   (PCL4C_S.MIX,
  580.          PCL4C_M.MIX  and  PCL4C_L.MIX).   MIX  doesn't support the compact
  581.          memory model.
  582.  
  583.          MODEL      CODE      DATA     Library
  584.          Small      Near      Near     PCL4C_S.LIB & PCL4C_S.MIX
  585.          Compact    Near      Far      PCL4C_C.LIB
  586.          Medium     Far       Near     PCL4C_M.LIB & PCL4C_M.MIX
  587.          Large      Far       Far      PCL4C_L.LIB & PCL4C_L.MIX
  588.  
  589.          However,  one  can  always  use  the  large  memory  model library
  590.          PCL4C_L.LIB with any memory model application code  by  explicitly
  591.          declaring  the  PCL4C  procedures  to  be  FAR (by prefixing "far"
  592.          before the  name  of  each  function  in  the  PCL4C.H  file)  and
  593.          declaring  your  receive  buffer  to  be FAR. If you are compiling
  594.          with the HUGE memory mode, link with PCL4C_L.LIB.
  595.  
  596.          The equivalent libraries with transmitter interrupts  enabled  are
  597.          PCL4C_S2.LIB, PCL4C_C2.LIB, PCL4C_M2.LIB, & PCL4C_L2.LIB.
  598.  
  599.  
  600.         PCL4C Users Manual                                     Page 10
  601.          3.2 Compilers Supported
  602.  
  603.  
  604.          At this time, five C compilers are supported by PCL4C.
  605.  
  606.          (1)  Microsoft (Optimizing) C Compiler.
  607.  
  608.          (2)  Quick C Compiler.
  609.  
  610.          (3)  Turbo C Compiler.
  611.  
  612.          (4)  Borland C Compiler.
  613.  
  614.          (5)  MIX Power C Compiler
  615.  
  616.          The  Microsoft  Optimizing  C Compiler supports all memory models.
  617.          Just be careful to link with the PCL4C library that corresponds to
  618.          the memory model used. Recall that the small memory model  is  the
  619.          default.   Examine  the  (small  model)  makefiles  *._M_  for the
  620.          Microsoft compiler.
  621.  
  622.          The Microsoft Quick C Compiler supports all memory models, but  be
  623.          careful  to  link with the PCL4C library that corresponds with the
  624.          memory model used.  Recall that the  small  memory  model  is  the
  625.          default  for  the  command  line  compiler  (QCL) while the medium
  626.          memory  model  is  the  default  for  the   interactive   compiler
  627.          environment.   Examine  the  (small model) makefiles *._Q_ for the
  628.          Microsoft Quick C compiler.
  629.  
  630.          The Borland and Turbo C Compilers also supports all memory models.
  631.          Be sure to link with the correct PCL4C  library  corresponding  to
  632.          the  memory model used.  Examine the (small model) makefiles *._T_
  633.          for the Turbo C compiler.
  634.  
  635.          The  MIX  Power  C  Compiler supports the small, medium, and large
  636.          memory models. However, older versions of Power C only support the
  637.          small model.   Examine  the  (small  model)  project  batch  files
  638.          X_*.BAT for the Power C Compiler.
  639.  
  640.          Other compilers may also work  with  one  or  more  of  the  PCL4C
  641.          libraries  but  have  not been tested. Since registered users have
  642.          the source code to the library, it  should  not  be  difficult  to
  643.          modify PCL4C for use with any MSDOS C compiler.
  644.  
  645.  
  646.  
  647.  
  648.  
  649.  
  650.  
  651.  
  652.  
  653.  
  654.  
  655.  
  656.  
  657.  
  658.  
  659.  
  660.         PCL4C Users Manual                                     Page 11
  661.          3.3 Using the Library
  662.  
  663.  
  664.          The  PCL4C  has  been tested on a TANDY 1000 (4.77 MHZ 8088 IBM PC
  665.          clone), a TANDY 3000 (80286 IBM AT clone), a TANDY 1400LT (IBM  XT
  666.          clone),  and  a  Gateway  2000 Cache (25 MHZ 80386-DX).  PCL4C has
  667.          been tested under MSDOS 2.11, 3.2, 3.3, 4.01, and 5.0.
  668.  
  669.          Please examine the PCL4C.H file. Note that COM1 is defined as port
  670.          zero,  not  port  one.  The user must assume the responsibilty for
  671.          passing the correct  information  when  calling  PCL4C  functions.
  672.  
  673.          If  there are any conflicts between PCL4C definitions and those in
  674.          other libraries, the PCL4C  definitions  can  be  changed  in  the
  675.          PCL4C.H  file  and  any file that uses the definition. There is no
  676.          change necessary for the library code itself.
  677.  
  678.  
  679.          3.4 Example Programs
  680.  
  681.  
  682.          Two communications programs are provided as a demonstration of the
  683.          PCL4C library -- SIMPLE and TERM.
  684.  
  685.          SIMPLE is provided as  the  simpliest  example  of  communications
  686.          programming using PCL4C. The user should compile and link SIMPLE.C
  687.          as a test of the library.
  688.  
  689.          If you have two computers, connect them together with a null modem
  690.          cable and run SIMPLE on both machines.  The baud rate in SIMPLE is
  691.          hard  coded to 2400 baud. It is easily changed in the source code.
  692.          Start SIMPLE by typing SIMPLE followed by the port. For example:
  693.  
  694.               SIMPLE 1
  695.  
  696.          Once SIMPLE is started on both computers, whatever is typed on one
  697.          machine should be displayed on the other, and vice versa.
  698.  
  699.          The TERM program is a more capable terminal emulator than  SIMPLE.
  700.          It  features modem initialization, hardware flow control, and file
  701.          transfer using ASCII, XMODEM, YMODEM, and YMODEM-G  communications
  702.          protocols.  TERM can be used to call up any bulletin board system,
  703.          including  the  MarshallSoft  Computing BBS.  Start TERM by typing
  704.          TERM followed by the port and baud rate. For example:
  705.  
  706.               TERM 4 2400
  707.  
  708.          Refer to the chapter "Terminal Emulator Program"  for  a  complete
  709.          discussion of TERM.
  710.  
  711.          Other example programs may be included on your distribution disk.
  712.  
  713.  
  714.  
  715.  
  716.  
  717.  
  718.  
  719.  
  720.         PCL4C Users Manual                                     Page 12
  721.          3.5 Compiling and Linking
  722.  
  723.  
  724.          Registered  users  may  wish  to  assemble PCL4C.ASM.  Use the /MX
  725.          switch in order to disable automatic conversion from lower case to
  726.          upper case.  If the  /MX  switch  is  not  used,  then  all  PCL4C
  727.          function  references  in C code must be in upper case. To assemble
  728.          using the Microsoft assembler:
  729.  
  730.          Model    Command
  731.  
  732.          Small    MASM PCL4C /DSMALL_MODEL /MX;
  733.          Compact  MASM PCL4C /DCOMPACT_MODEL /MX;
  734.          Medium   MASM PCL4C /DMEDIUM_MODEL /MX;
  735.          Large    MASM PCL4C /DLARGE_MODEL /MX;
  736.  
  737.          To  enable  transmitter  interrupts,  add "/DSET_TBE" to each MASM
  738.          command line above.
  739.  
  740.          For example, to make the (small) model PCL4C.OBJ  into  a  library
  741.          file:
  742.  
  743.                DEL PCL4C_S.LIB
  744.                LIB PCL4C_S.LIB+PCL4C,PCL4C.MAP;
  745.  
  746.          If you are using the MIX Power C Compiler, create the  MIX  object
  747.          file (you will need version 1.3 of MIX which has the /_ switch):
  748.  
  749.                MIX /_ PCL4C_S
  750.  
  751.          Similarly with the other memory  model  libaries.  See  the  batch
  752.          files   MAKE_S.BAT,   MAKE_C.BAT,   MAKE_M.BAT,   and  MAKE_L.BAT.
  753.          Similiarly  for   MAKE_ST.BAT,   MAKE_CT.BAT,   MAKE_MT.BAT,   and
  754.          MAKE_LT.BAT.
  755.  
  756.          To compile and link (small model) using Microsoft C:
  757.  
  758.                cl /AS simple.c /link pcl4c_s.lib
  759.  
  760.          To compile and link (small model) using Microsoft Quick C:
  761.  
  762.                qcl /AS simple.c /link pcl4c_s.lib
  763.  
  764.          To compile and link (small model) using Turbo C:
  765.  
  766.                tcc -ms simple.c pcl4c_s.lib
  767.  
  768.          To compile and link (small model) using Power C:
  769.  
  770.                pc /ms simple.c
  771.                pcl simple pcl4c_s.mix
  772.  
  773.          Makefiles or project files are provided for both SIMPLE and  TERM.
  774.          Borland  and  Turbo  C  makefiles  end  with the extension '._T_',
  775.          Microsoft  C  makefiles  end  with  '._M_',  Microsoft   Quick   C
  776.          makefiles  files  end with '._Q_', and Power C project batch files
  777.          start with 'X_' and end with '.BAT'.
  778.  
  779.  
  780.         PCL4C Users Manual                                     Page 13
  781.          4.0 Talking to Your Modem
  782.  
  783.  
  784.          A modem is  used  to  extend  the  distance  over  which  you  may
  785.          communicate.   Without  a  modem, your RS232 cable is limited to a
  786.          maximum of approximately 50  feet.  But  with  a  modem,  you  can
  787.          communicate literally around the world.
  788.  
  789.  
  790.          4.1 Modem Standards
  791.  
  792.  
  793.          Two modems can communicate over a telephone line only if they  are
  794.          both  using  the  same signaling frequencies and modulation, which
  795.          are determined by the the modem standards used.   Modem  standards
  796.          can  be  divided  into three sets: (1) speed, (2) data compression
  797.          used, and (3) error control.
  798.  
  799.          The Bell standards (103 & 212A) are those of AT&T.  The CCITT (The
  800.          International  Consultative Committee for Telephone and Telegraph)
  801.          standards are designated as "V. ".
  802.  
  803.  
  804.          Speed
  805.  
  806.  
  807.          Bell 103  --   300 baud
  808.          Bell 212A --  1200 baud
  809.          V.21      --   300 baud
  810.          V.22bis   --  1200 & 2400 baud
  811.          V.32      --  4800 & 9600 baud
  812.          V.32bis   --  4800, 7200, 9600, 12000, and 14400 baud
  813.  
  814.  
  815.          Data Compression
  816.  
  817.  
  818.          MNP 5     --  Microcom Networking Protocol (proprietary).
  819.          V.42bis   --  International data compression standard.
  820.  
  821.  
  822.          Error Control
  823.  
  824.  
  825.          MNP 2,3,4 --  Three level error correction (public domain).
  826.          V.42      --  International error correction standard.
  827.  
  828.  
  829.  
  830.  
  831.  
  832.  
  833.  
  834.  
  835.  
  836.  
  837.  
  838.  
  839.  
  840.         PCL4C Users Manual                                     Page 14
  841.          4.2 Flow Control
  842.  
  843.  
  844.          With modems using data compression, the modem to modem  connection
  845.          will  run  at various speeds depending on the quality of the line.
  846.          The computer to modem connection will be at  a  fixed  baud  rate.
  847.          Therefore,  a  protocol (flow control) is necessary to synchronize
  848.          the data flow  between  and  modems  and  the  computer  to  modem
  849.          connection.   Refer  to  your modem manual for information on flow
  850.          control protocols supported.
  851.  
  852.          Two  flow  control  protocols  are  used  by most all modems which
  853.          require flow control. Software flow control is  called  "XON/XOFF"
  854.          (other  software  flow  control  character  pairs  are defined but
  855.          operate the same as XON/XOFF) and hardware flow control is  called
  856.          "RTS/CTS".  Most modems which require flow control enable hardware
  857.          flow control by default.
  858.  
  859.          In   XON/XOFF  (software)  flow  control,  the  computer  suspends
  860.          transmitting data if it receives a XOFF character  (13  hex)  from
  861.          the  modem,  and  continues  transmitting  when  it receives a XON
  862.          character (11 hex).  Similiarly, the computer can signal the modem
  863.          not to send any more data by transmitting a XOFF to  it,  and  can
  864.          tell the modem to continue transmission be sending a XON.
  865.  
  866.          In  RTS/CTS  (hardware)  flow control, the RTS line is used by the
  867.          computer to signal the modem , while the CTS line is used  by  the
  868.          modem  to  signal  the  computer.  The  RTS line is set OFF by the
  869.          computer to tell the modem to suspend transmission, and set to  ON
  870.          to  tell  the modem to continue transmission.  The CTS line is set
  871.          to OFF by the modem to tell the computer to stop transmitting, and
  872.          set to ON to tell the computer to continue transmitting.
  873.  
  874.          Given  the  choice,  always  choose  hardware  flow  control  over
  875.          software  flow  control  so  that   all   data   transmission   is
  876.          transparent.   If  hardware flow control is not the default (which
  877.          it almost always is), you should modify your modem  initialization
  878.          string to turn hardware flow control on.
  879.  
  880.          Both software and hardware flow control is easy to implement using
  881.          PCL4C. See TERM_IO.C for an example of hardware flow control.
  882.  
  883.  
  884.  
  885.  
  886.  
  887.  
  888.  
  889.  
  890.  
  891.  
  892.  
  893.  
  894.  
  895.  
  896.  
  897.  
  898.  
  899.  
  900.         PCL4C Users Manual                                     Page 15
  901.          4.3 Modem Initialization
  902.  
  903.  
  904.          If your application uses a modem (as opposed to using a null modem
  905.          cable),  then  you  should always send an initialization string to
  906.          your modem if it is a programmable modem such  as  those  made  by
  907.          Hayes.   Communication  programs  such as PROCOMM and TELIX always
  908.          send such a string automatically as soon as they start up.
  909.  
  910.          The particular initialization string depends on the make  of  your
  911.          modem.   For Hayes and Hayes AT command set compatible modems, the
  912.          following string (followed by a carriage return) should work:
  913.  
  914.               AT E1 S7=60 S11=60 V1 X1 Q0 S0=0
  915.  
  916.          Refer to your Modem User's Guide for a full  discussion  of  these
  917.          commands. A brief description is as follows:
  918.  
  919.          AT     Modem attention command.
  920.          E1     Modem will echo what you send to it.
  921.          S7=60  Wait 60 seconds for carrier and/or dial tone.
  922.          S11=60 Use 60 milliseconds for tone dialing duration & spacing.
  923.          V1     Display result code as words (not numbers).
  924.          X1     Use the extended result message (CONNECT XXXX) set.
  925.          Q0     Modem returns result codes.
  926.          S0=0   Do not answer RING.
  927.  
  928.          If your application will answer incoming calls, then  set  the  S0
  929.          register to the ring on which to automatically answer.
  930.  
  931.          If you send the above codes by using SioPutc (as opposed to typing
  932.          them from the keyboard), then follow these guidelines:
  933.  
  934.          (1) Send an initial  carriage  return  before  the  initialization
  935.          string.
  936.  
  937.          (2) Pause at least two tics (18 tics to  the  second)  after  each
  938.          character  sent  as  your  modem needs the time to perform its own
  939.          internal processing.  Pause a little longer if your modem  is  not
  940.          accepting your initialization string.
  941.  
  942.          (3) Pause one and a half seconds after sending any  initialization
  943.          command  such  as ATZ or AT&F since your modem must do quite a bit
  944.          of processing.
  945.  
  946.          If you experience any problems in initializing your  Hayes  modem,
  947.          you should first reset it to factory settings by sending:
  948.  
  949.               AT&F
  950.  
  951.          Refer  to  the  TERM  program (functions SendTo and WaitFor in the
  952.          file MODEM_IO.C) for  an  example  of  sending  an  initialization
  953.          string to a Hayes compatible modem.
  954.  
  955.  
  956.  
  957.  
  958.  
  959.  
  960.         PCL4C Users Manual                                     Page 16
  961.          5.0 Problems
  962.  
  963.  
  964.          If  you cannot get your application to run properly, first compile
  965.          and run the  terminal  emulator  program  TERM  provided  on  your
  966.          distribution  disk.   If  you  are  using  a null modem cable or a
  967.          non-programmable modem, be sure to set the HAYES constant to 0  in
  968.          the  source  code  (#define  AT_COMMAND_SET 0). If you are using a
  969.          Hayes compatible modem, set the AT_COMMAND_SET constant to 1.   If
  970.          you  are using a programmable modem which is not Hayes compatible,
  971.          then you must modify the initialization string for your particular
  972.          modem.
  973.  
  974.          If your application does not run but TERM runs correctly, then you
  975.          have  most  likely made a programming mistake in your application.
  976.          MarshallSoft Computing cannot debug your  application,  especially
  977.          over  the telephone!  However, consider each of the following when
  978.          searching for an error in your application.
  979.  
  980.          1.  Have you included the file PCL4C.H in your application ?
  981.  
  982.          2.  Did you link with the correct PCL4C library  ?   This  is  the
  983.              most  probable cause if your application 'hangs' as soon as it
  984.              starts and you must reboot. The function SioInfo() returns the
  985.              the model ID under which the library was assembled.
  986.  
  987.          3.  Is your receive buffer large enough ? If you are using 1K data
  988.              blocks in YMODEM, then your receive buffer should be at  least
  989.              1K (2K if baud rates above 19200 are to be used).
  990.  
  991.          4.  Have you selected too high a baud rate  (if you  are  using  a
  992.              slow PC) ?   If only one COM port is being run, you should  be
  993.              able to run at 38400 baud on 8088 machines and 115200 on  most
  994.              286 and all 386 and 486 machines.
  995.  
  996.          5.  Are  you  attempting  to  run  another  application   in   the
  997.              background ?  Try running  without any other programs  running
  998.              in the background (unload all TSR programs).
  999.  
  1000.          6.  If you are running two COM ports simultaneously, are you using
  1001.              separate receive buffers ? (you should).
  1002.  
  1003.          7.  Did SioReset return a zero value ?  If not, then you must call
  1004.              SioReset again. See TERM.C for an example.
  1005.  
  1006.          8.  Did you send the proper initialization string to your modem  ?
  1007.              Did you set DTR and RTS ? (you should).
  1008.  
  1009.          9.  Do you have more than one COM1 port, etc.  For example, if you
  1010.              have a COM1 port on your motherboard,  you cannot add  another
  1011.              COM1  port  or  modem  board  that  uses  COM1  without  first
  1012.              disabling the COM1 on the motherboard.
  1013.  
  1014.         10.  Your first comm port should be COM1.  If  you  have  a  second
  1015.              port, it should be COM2, not COM3 or COM4.
  1016.  
  1017.  
  1018.  
  1019.  
  1020.         PCL4C Users Manual                                     Page 17
  1021.          6.0 Serial Communications
  1022.  
  1023.          6.1 Communications Basics
  1024.  
  1025.  
  1026.          The  heart  of  serial  communications  is  the  UART   (Universal
  1027.          Asynchronous   Receiver   Transmitter).    The  IBM  PC/XT/AT  and
  1028.          compatibles use the INS8250, INS16450, or the INS16550 UART.   The
  1029.          purpose of the UART is:
  1030.  
  1031.          (1)  To convert bytes from the CPU (Central Processing Unit), into
  1032.          a serial format by adding the necessary start,  stop,  and  parity
  1033.          bits  to  each byte before transmission, and to then transmit each
  1034.          bit at the correct baud rate.
  1035.  
  1036.          (2) To convert the incoming stream (at a specified baud  rate)  of
  1037.          serial  bits  into  bytes  by removing the start, stop, and parity
  1038.          bits before being made available to the CPU.
  1039.  
  1040.          The  UART  is  part of the serial interface circuitry which allows
  1041.          the CPU to send and receive signals over the RS232 lines. This can
  1042.          be diagrammed as follows:
  1043.  
  1044.                                Serial Interface
  1045.                             *********************
  1046.                             *                   *
  1047.          *******  Data Bus  *     ********      *    RS232 Signals
  1048.          * CPU **************     * UART *      ******************
  1049.          *******            *     ********      *
  1050.                             *                   *
  1051.                             *********************
  1052.  
  1053.          The  INS8250/16450/16550  UART  is  capable of operating in one of
  1054.          two  modes,  "polled"  and   "interrupt   driven".    The   serial
  1055.          communications  functions  in the BIOS uses the polled method.  In
  1056.          this approach, the CPU is typically in  a  loop  asking  the  UART
  1057.          over  and  over  again  if  it  has a byte ready. If its does, the
  1058.          polling code returns the byte.  But, if the  next  byte  comes  in
  1059.          before  the  polling  code  is  executing again, then that byte is
  1060.          lost.
  1061.  
  1062.          In  the  interrupt  driven  approach  (used  by PCL4C for incoming
  1063.          data), when a byte is received by the UART, an "Interrupt  Service
  1064.          Routine"  (ISR)  is  executed  immediately, suspending temporarily
  1065.          whatever else is executing.  The ISR then  moves  the  byte  to  a
  1066.          buffer  so  that your application program can later read it. Refer
  1067.          to the sections entitled "RS232  Signals"  and  "National  INS8250
  1068.          UART" for further information on these topics.
  1069.  
  1070.  
  1071.  
  1072.  
  1073.  
  1074.  
  1075.  
  1076.  
  1077.  
  1078.  
  1079.  
  1080.         PCL4C Users Manual                                     Page 18
  1081.          6.2 Standard Port Addresses
  1082.  
  1083.  
  1084.          There  are  a  few  things to know about how serial communications
  1085.          ports are used by  IBM  PC/XT/AT  and  compatible  computers.  The
  1086.          standard IBM PC/XT/AT configuration values are as follows:
  1087.  
  1088.          Port     Reg Base   IRQ Line   Vector
  1089.          COM1        3F8H        4        12
  1090.          COM2        2F8H        3        11
  1091.          COM3        3E8H        4        12
  1092.          COM4        2E8H        3        11
  1093.  
  1094.          (Refer to your DigiBoard manual for DigiBoard addresses).
  1095.  
  1096.          PCL4C  assumes  the  above  values.   If  necessary, the UART base
  1097.          address  can  be  changed  by  SioUART,  and  IRQ  lines  can   be
  1098.          re-assigned  by  SioIRQ.   Remember  that  each  port  to  be used
  1099.          concurrently must have a unique  IRQ  line.  Refer  to  the  PCL4C
  1100.          Reference Manual for specific details.
  1101.  
  1102.          When installing new communications cards, the following guidelines
  1103.          are recommended:
  1104.  
  1105.          (1)  Be  sure  to  read the documentation for the hardware you are
  1106.          installing.  Pay special attention to UART base addresses and  IRQ
  1107.          lines,   particularly   if   trying   to  set  up  a  non-standard
  1108.          configuration.
  1109.  
  1110.          (2) If you have a choice in base addresses and IRQ  lines,  always
  1111.          choose standard values as defined above.
  1112.  
  1113.          (3)  The  first port should be COM1, the second COM2, etc.  Do NOT
  1114.          skip over any port.
  1115.  
  1116.          (4)  Use  SioUART  to  zero  all  unused  ports (for example, call
  1117.          SioUART(COM4,0) if there is no COM4 port installed).
  1118.  
  1119.          (5) Be carefull not to configure two ports for the  same  address.
  1120.          This is easier to do than you may believe.
  1121.  
  1122.          (6)  Choose  an  external  modem over an internal one.  It is much
  1123.          easier to debug problems with an external modem than  an  internal
  1124.          one.
  1125.  
  1126.          (7)  Select  hardware  flow  control  (RTS/CTS) if flow control is
  1127.          required and hardware flow control is not the default.
  1128.  
  1129.          (8) Always test your port as soon as it is installed. Try  several
  1130.          programs that use the communications ports.
  1131.  
  1132.  
  1133.  
  1134.  
  1135.  
  1136.  
  1137.  
  1138.  
  1139.  
  1140.         PCL4C Users Manual                                     Page 19
  1141.          6.3 Running 3 or 4 Ports Concurrently
  1142.  
  1143.  
  1144.          PCL4C supports up to 4 serial ports running concurrently (more  if
  1145.          you  have  a  DigiBoard).   One  free  interrupt  for each port is
  1146.          required. Refer to the next section if you have a DigiBoard.
  1147.  
  1148.          Interrupts IRQ4 and IRQ3 are dedicated to the communications ports
  1149.          in a standard IBM PC/XT/AT configuration.  IRQ4 is shared  between
  1150.          COM1  and  COM3  while IRQ3 is shared between COM2 and COM4.  This
  1151.          means that you can run two ports simultaneously provided that they
  1152.          don't share an interrupt.
  1153.  
  1154.          Suppose that you wish to run 3 ports simultaneously. To begin, you
  1155.          must have 3 serial UARTs installed on your computer.  Assume,  for
  1156.          purposes  of  this  discussion,  that  COM1  is  installed on your
  1157.          motherboard,  and  that  you  have  purchased   a   new   2   port
  1158.          serial communications board.
  1159.  
  1160.          You  should  be  able  to configure the first serial board port as
  1161.          COM2, which uses IRQ3.  Refer to the manual that  came  with  your
  1162.          serial board.
  1163.  
  1164.          In order to run the third serial port concurrently with the  first
  1165.          two,  an  unused interrupt must be found.  If your serial card can
  1166.          use only IRQ3 and IRQ4, then there is no way to run a  third  line
  1167.          since IRQ4 and IRQ3 are used for COM1 and COM2.
  1168.  
  1169.          However,  many  serial  cards  can  use other IRQs, typically IRQ2
  1170.          through IRQ5. Since IRQ5 is normally used  for  a  second  printer
  1171.          port,  it  is a good candidate for COM3. To use IRQ5 for the third
  1172.          serial port, first set your serial  card  to  use  IRQ5  for  COM3
  1173.          (refer to your serial card manual) and then add the following line
  1174.          to your applications code before calling SioReset:
  1175.  
  1176.                 SioIRQ(COM3,IRQ5);
  1177.  
  1178.          Don't forget to disable any device that might use IRQ5, such as  a
  1179.          second  printer  port or a music card.  Unfortunately, there is no
  1180.          easy way to  determine  that  you  have  no  conflicts  until  you
  1181.          actually  attempt  to  use  the  IRQ. If there are conflicts, your
  1182.          system will probably hang and you will have to reboot.
  1183.  
  1184.          To run a fourth serial port, another free IRQ must  be  found.  On
  1185.          some  systems, IRQ2 can be used. To use IRQ2 for the fourth serial
  1186.          port, first set your serial card to use IRQ2  for  COM4  and  then
  1187.          add:
  1188.  
  1189.                 SioIRQ(COM4,IRQ2);
  1190.  
  1191.          To summarize, your serial  card  must  be  able  to  generate  the
  1192.          correct  IRQ,  which is not already being used. Refer to the entry
  1193.          for the SioIRQ function in the PCL4C Reference Manual.
  1194.  
  1195.  
  1196.  
  1197.  
  1198.  
  1199.  
  1200.         PCL4C Users Manual                                     Page 20
  1201.          6.4 Using the DigiBoard
  1202.  
  1203.  
  1204.          The  Personal  Communications  Library supports the DigiBoard PC/4
  1205.          and  PC/8. In order to use the DigiBoard, you must configure PCL4C
  1206.          using the SioPorts(), SioUART(), and SioIRQ() functions.
  1207.  
  1208.          Your PCs ports must be partitioned into "standard"  PC  ports  and
  1209.          DigiBoard  ports.   Remember  that  standard PC ports cannot share
  1210.          IRQs like the DigiBoard can. If you are using IRQ4  and  IRQ3  for
  1211.          standard  PC  ports  COM1 and COM2, then you cannot use either for
  1212.          DigiBoard ports (try IRQ5 or IRQ2).
  1213.  
  1214.          Suppose  that  COM1 through COM2 are standard PC ports (using IRQ4
  1215.          and IRQ3) and you have installed a PC/8 DigiBoard that you wish to
  1216.          use for COM3 through COM10 using interrupt line IRQ5.  You  choose
  1217.          to  use  the recommended DigiBoard UART addresses at 0x100, 0x108,
  1218.          0x110, 0x118, 0x120, 0x128, 0x130, and 0x138.  Add  the  following
  1219.          configuration statements before doing any other serial processing:
  1220.  
  1221.             SioPorts(10,COM3,0x140);   /* COM3 is first DigiBoard port */
  1222.             Address  = 0x100;          /* first DigiBoard UART address */
  1223.             for(Port=COM3;Port<=COM10;Port++)  /* look at each port    */
  1224.                {SioUART(Port,Address);         /* set the UART address */
  1225.                 Address += 8;                  /* compute next address */
  1226.                 SioIRQ(Port,IRQ5);     /* set the DigiBoard IRQ */
  1227.                }
  1228.  
  1229.          The DigiBoard uses 0x140 for the status address for odd interrupts
  1230.          and  0x141 for even interrupts.  Thus 0x140 is used for the status
  1231.          address since IRQ5 is used for the interrupt in the example above.
  1232.  
  1233.          Don't forget that your DigiBoard hardware must  be  configured  to
  1234.          match  the  IRQ  and  UART values that you specify in the library.
  1235.          Refer to your DigiBoard manuals for more information.
  1236.  
  1237.          The PCL4C library comes configured for 4 PC ports and no DigiBoard
  1238.          ports  --  SioPorts(4,4).  Refer to the PCL4C Reference Manual for
  1239.          more detailed information on SioPorts(), SioUART(), and SioIRQ().
  1240.  
  1241.          If  you  are interested in the DigiBoard, they may be contacted at
  1242.          6400 Flying  Cloud  Drive,  Eden  Prairie,  MN  55344.   Telephone
  1243.          612-943-9020 or FAX 612-943-5398.
  1244.  
  1245.  
  1246.  
  1247.  
  1248.  
  1249.  
  1250.  
  1251.  
  1252.  
  1253.  
  1254.  
  1255.  
  1256.  
  1257.  
  1258.  
  1259.  
  1260.         PCL4C Users Manual                                     Page 21
  1261.          6.5 Transmitter Interrupts
  1262.  
  1263.  
  1264.          Beginning in version 4.0  of  PCL4C,  transmitter  interrupts  are
  1265.          supported  by  the  library.  Separate libraries are provided, one
  1266.          with  transmitter  interrupts  enabled  and  one   without.   When
  1267.          transmitter interrupts are NOT enabled, the following logic occurs
  1268.          everytime you call SioPutc():
  1269.  
  1270.                1. Wait for transmit buffer to become empty. The transmit
  1271.                   buffer may not be empty if the previous transmit is not
  1272.                   completed (the UART breaks down the byte & sends 1 bit
  1273.                   at a time).
  1274.                2. When the transmit buffer is empty, the byte from the
  1275.                   SioPutc() call is loaded into the transmit buffer and
  1276.                   control is returned to the caller.
  1277.  
  1278.          Note  that  you  can not write to the UART any faster the the UART
  1279.          baud rate.
  1280.  
  1281.          When  transmitter  interrupts are enabled, the byte from SioPutc()
  1282.          is put into a previously prepared (by SioTxQue) transmitter queue.
  1283.          The interrupt service routine fetches bytes  from  this  queue  as
  1284.          soon  as  the  previous byte has been sent.
  1285.  
  1286.          While  you can now call SioPutc() faster than the baud rate, bytes
  1287.          are still transmitted at the given baud rate.
  1288.  
  1289.          The above sounds like transmitter interrupts are the  way  to  go.
  1290.          Unfortunately,  this  is  usually NOT the case.  Most applications
  1291.          will perform better if transmitter interrupts are NOT enabled.
  1292.  
  1293.          The  reason  is  that  transmitter interrupts double the amount of
  1294.          code in the time critical interrupt service routines.   While  the
  1295.          library  is  processing  a transmitter interrupt (which can take a
  1296.          while), incoming bytes can not be processed. What  this  means  is
  1297.          that  a  given  machine  can  run  at  a  higher baud rate without
  1298.          transmitter interrupts. This problem is  compounded  when  running
  1299.          multiple ports simultaniously.
  1300.  
  1301.          However,  there  are  a  few  application  areas where transmitter
  1302.          interrupts  are  preferable.   If   your   application   will   be
  1303.          transmitting  blocks  of  data at fairly slow baud rates you might
  1304.          profit from enabling transmitter interrupts provided that there is
  1305.          something else for the processor to do (which is NOT the  case  in
  1306.          most protocols).
  1307.  
  1308.          Recall  that   PCL4C_S2.LIB   (small),   PCL4C_C2.LIB   (compact),
  1309.          PCL4C_M2.LIB  (medium),  and  PCL4C_L2.LIB  (large)  are  the four
  1310.          memory model libraries with transmitter interrupts enabled.
  1311.  
  1312.  
  1313.  
  1314.  
  1315.  
  1316.  
  1317.  
  1318.  
  1319.  
  1320.         PCL4C Users Manual                                     Page 22
  1321.          6.6 RS-232 Signals
  1322.  
  1323.  
  1324.          RS-232 is the name of the serial data interface standard  used  to
  1325.          connect  computers  to  modems.  Most IBM compatible computers are
  1326.          built with at least one serial port and use either DB9 (9 pin)  or
  1327.          DB25 (25 pin) connectors.
  1328.  
  1329.          A summary of these pins and  their  function  follows.   For  more
  1330.          detailed  information, refer to one of the many books dealing with
  1331.          RS-232 interfacing.
  1332.  
  1333.          Signal Ground Pin 7 (DB25), Pin 5 (DB9)
  1334.  
  1335.          The SG line is used as the common signal ground, and  must  always
  1336.          be connected.
  1337.  
  1338.          Transmit Data Pin 2 (DB25), Pin 3 (DB9)
  1339.  
  1340.          The TX line is used to carry data from the computer to the modem.
  1341.  
  1342.          Receive Data Pin 3 (DB25), Pin 2 (DB9)
  1343.  
  1344.          The RX line is used to carry data from the modem to the computer.
  1345.  
  1346.          Data Terminal Ready Pin 20 (DB25), Pin 4 (DB9)
  1347.  
  1348.          The  DTR  line is used by the computer to signal the modem that it
  1349.          is ready. DTR should be set high when talking to a modem.
  1350.  
  1351.          Data Set Ready Pin 6 (DB25), Pin 6 (DB9)
  1352.  
  1353.          The DSR line is used by the modem to signal the computer  that  it
  1354.          is ready.
  1355.  
  1356.          Request to Send Pin 4 (DB25), Pin 7 (DB9)
  1357.  
  1358.          The  RTS  line  is  used  to "turn the line around" in half duplex
  1359.          modems, and for hardware flow control in most modems that  require
  1360.          flow control.
  1361.  
  1362.          Clear to Send Pin 5 (DB25), Pin 8 (DB9)
  1363.  
  1364.          The  CTS  line  is  used  to "turn the line around" in half duplex
  1365.          modems, and for hardware flow control in most modems that  require
  1366.          flow control.
  1367.  
  1368.          Data Carrier Detect Pin 8 (DB25), Pin 1 (DB9)
  1369.  
  1370.          The DCD line is used by the modem to signal the  computer  that  a
  1371.          data carrier signal is present.
  1372.  
  1373.          Ring Indicator Pin 22 (DB25), Pin 9 (DB9)
  1374.  
  1375.          The RI line is asserted when a 'ring' occurs.
  1376.  
  1377.  
  1378.  
  1379.  
  1380.         PCL4C Users Manual                                     Page 23
  1381.          6.7 National INS8250, INS16450, and INS16550 UARTs
  1382.  
  1383.  
  1384.          The  Personal  Communications  Library  is  based  on the standard
  1385.          National INS8250, INS16450, and INS16550 UARTs. The 8250  was  the
  1386.          original  UART  used  in the IBM PC, whereas the 16450 is a faster
  1387.          version found on most 286 & up machines. The 16550 contains  a  16
  1388.          byte  FIFO  to further reduce communications overhead. These UARTs
  1389.          consists of 8 register ports as follows:
  1390.  
  1391.          Offset    R/W   Register
  1392.            0       R/W   Receiver (read) / Transmitter (write)
  1393.            1       R/W   Interrupt Enable (read)
  1394.            2       R     Interrupt Identification
  1395.            2       W     FIFO control (INS16550 only)
  1396.            3       R/W   Data Format (Line Control)
  1397.            4       R/W   RS-232 (Modem) Control
  1398.            5       R/W   Line Status
  1399.            6       R/W   RS-232 (Modem) Status
  1400.            7       R/W   Not used.
  1401.  
  1402.          For  the  standard  PC  ports  (not  DigiBoard  ports),  the  UART
  1403.          registers  are based at 3F8h (COM1), 2F8h (COM2), 3E8h (COM3), and
  1404.          2E8h (COM4).  COM1 and COM3  share  interrupt  request  line  IRQ4
  1405.          while COM2 and COM4 share request line IRQ3.  This means that COM1
  1406.          and COM3 can't be used concurrently.  Similarly for COM2 and COM4.
  1407.  
  1408.          If  you have a DigiBoard PC/4 (or PC/8) installed, you will have 4
  1409.          (or 8) additional ports using INS16450  or  INS16550  UARTS.   The
  1410.          default DigiBoard ports are located at 100h, 108h, 110h & 118h for
  1411.          the PC/4 continuing with 120h 128h, 130h & 138h for the PC/8. IRQ3
  1412.          is the default for all ports.
  1413.  
  1414.          Four sources of interrupts are possible with the 8250  and  16550:
  1415.          (1) receiver error or BREAK, (2) receiver data ready, (3) ready to
  1416.          transmit,  and  (4) RS232 input.  These four sources of interrupts
  1417.          are summarized as follows:
  1418.  
  1419.          Source of Interrupt        Action Required to Clear
  1420.          Receiver error or BREAK.   Read Line Status register.
  1421.          Receiver data.             Read data from data register.
  1422.          Transmitter Buffer Empty.  Write to data register or read IID reg.
  1423.          RS232 input.               Read Modem Status register.
  1424.  
  1425.          However,  PCL4C  only  enables  the receiving data interrupt. This
  1426.          means that interrupts can only be caused by incoming data.
  1427.  
  1428.          If  you  are not familiar with the INS8250, several good books are
  1429.          available.   Refer  to  the  Serial  Communications  chapter   for
  1430.          recommendations.    Although  a  knowledge  of  the  8250  is  not
  1431.          necessary to use PCL4C, a  general  knowledge  of  the  theory  of
  1432.          asynchronous serial communications is recommended.
  1433.  
  1434.  
  1435.  
  1436.  
  1437.  
  1438.  
  1439.  
  1440.         PCL4C Users Manual                                     Page 24
  1441.          6.8 Register Summary
  1442.  
  1443.  
  1444.          REG 0 : Data Register
  1445.  
  1446.          Reading  from  the data register fetches the next input byte, once
  1447.          it is ready.  Writing to the  data  register  transmits  the  byte
  1448.          written to it over the serial line.
  1449.  
  1450.          REG 1 : Interrupt Enable 
  1451.  
  1452.          The  Interrupt  Enable  register  enables  each  of  four types of
  1453.          interrupts when the appropriate bit is set to a one.
  1454.  
  1455.          bit 3 : Enable interrupt on RS232 input.
  1456.          bit 2 : Enable interrupt on receiver error or break.
  1457.          bit 1 : Enable interrupt on transmitter buffer empty (TBE).
  1458.          bit 0 : Enable interrupt on received data (RxRDY).
  1459.  
  1460.          REG 2 : Interrupt Identification (IID)
  1461.  
  1462.          Reading  the  Interrupt Identification (read only) register once
  1463.          an interrupt has occurred identifies the interrupt as follows:
  1464.  
  1465.          Bit 2  Bit 1  Bit 0  Priority    Interrupt
  1466.            0      0      1      none      none
  1467.            1      1      0      0 (high)  Serialization or break.
  1468.            1      0      0      1         Received data.
  1469.            0      1      0      2         Transmitter Buffer Empty.
  1470.            0      0      0      3 (low)   RS232 Input.
  1471.  
  1472.          In the INS16650, REG 2 (write  only)  is  also  the  FIFO  control
  1473.          register.   Writing  bits  6  &  7 will set the FIFO trigger level
  1474.          (number of bytes received before an interrupt is generated).
  1475.  
  1476.          Bit 7  Bit 6   Trigger             Bit 7  Bit 6   Trigger
  1477.           0      0      1 byte               1      0      8 bytes
  1478.           0      1      4 bytes              1      1      14 bytes
  1479.  
  1480.          REG 3 : Line Control
  1481.  
  1482.          RS232 line parameters are selected by writing to this register.
  1483.  
  1484.          bit 7   : DLAB = 0
  1485.          bit 6   : BREAK on(1), off(0).
  1486.          bits 5-3: Parity None(000),ODD(001),EVEN(011),MARK(101),SPACE(111)
  1487.          bit 2   : One stop bit(0), two stop bits(1).
  1488.          bits 1-0: Data bits = 5 (00), 6(01), 7(10), 8(11).
  1489.  
  1490.          When the Divisor Latch Access Bit (DLAB) is 1, registers 0  and  1
  1491.          become the LS and MS bytes of the Baud Rate Divisor registers.
  1492.  
  1493.          Baud   Divisor      Baud  Divisor      Baud  Divisor
  1494.           300    0180        4800   0018       38400   0003
  1495.          1200    0060        9600   000C       57600   0002
  1496.          2400    0030       19200   0006      115200   0001
  1497.  
  1498.  
  1499.  
  1500.         PCL4C Users Manual                                     Page 25
  1501.          REG 4 : Modem Control
  1502.  
  1503.          RTS, DTR, loopback testing, and General Purpose Outputs #1 and  #2
  1504.          are controlled by the Modem Control register as follows:
  1505.  
  1506.          bit 4 : Enable local loopback.
  1507.          bit 3 : Enable GP02. Necessary for 8250 interrupts.
  1508.          bit 2 : Enable GP01.
  1509.          bit 1 : Set / clear RTS.
  1510.          bit 0 : Set / clear DTR.
  1511.  
  1512.          REG 5 : Line Status
  1513.  
  1514.          Reading  the  Line  Status register provides status information as
  1515.          follows (1 for TRUE, 0 for FALSE) :
  1516.  
  1517.          bit 6 : Transmitter Empty.
  1518.          bit 5 : Transmitter Buffer Empty (TBE).
  1519.          bit 4 : BREAK detect.
  1520.          bit 3 : Framing error.
  1521.          bit 2 : Parity error.
  1522.          bit 1 : Overrun error.
  1523.          bit 0 : Data Ready.
  1524.  
  1525.          REG 6 : Modem Status
  1526.  
  1527.          Reading the Modem Status register provides  the  following  status
  1528.          information (1 for TRUE, 0 for FALSE) :
  1529.  
  1530.          bit 7 : DCD status.
  1531.          bit 6 : RI status.
  1532.          bit 5 : DSR status.
  1533.          bit 4 : CTS status.
  1534.          bit 3 : Delta DCD status.
  1535.          bit 2 : Delta RI status.
  1536.          bit 1 : Delta DSR status.
  1537.          bit 0 : Delta CTS status.
  1538.  
  1539.          The delta bits (bits 0 through 3) are  set  whenever  one  of  the
  1540.          status  bits  (bits 4 through 7) changes (from 0 to 1 or from 1 to
  1541.          0) since the last time that the Modem Status  register  was  read.
  1542.          Reading the Modem Status register clear the delta bits.
  1543.  
  1544.          REG 7 : Scratch Register
  1545.  
  1546.          There is no function associated with  register  7.   It  does  not
  1547.          exist in early versions of the 8250.
  1548.  
  1549.  
  1550.  
  1551.  
  1552.  
  1553.  
  1554.  
  1555.  
  1556.  
  1557.  
  1558.  
  1559.  
  1560.         PCL4C Users Manual                                     Page 26
  1561.          7.0 Terminal Emulator Example Program
  1562.  
  1563.  
  1564.          TERM is an communications program suitable  for  calling  bulletin
  1565.          board  systems  (BBS)  and  performing  as  a  PC  to PC file copy
  1566.          program.  TERM itself is not part of the  communications  library,
  1567.          but  rather  it  is  provided  as  an  example of a communications
  1568.          application using PCL4C.
  1569.  
  1570.          TERM  can  send a standard Hayes standard AT command set string to
  1571.          your modem.  An initialization string is  sent  by  TERM  provided
  1572.          that  the  constant AT_COMMAND_SET in the file TERM.CFG is defined
  1573.          to be TRUE:
  1574.  
  1575.             #define AT_COMMAND_SET 1
  1576.  
  1577.          Refer to the chapter "Modem Initialization" for  a  discussion  of
  1578.          initialization strings.
  1579.  
  1580.          TERM also supports hardware flow control (RTS/CTS). Hardware  flow
  1581.          control  is observed provided that the constant RTS_CTS_CONTROL in
  1582.          the file TERM.CFG is defined to be TRUE:
  1583.  
  1584.             #define RTS_CTS_CONTROL 1
  1585.  
  1586.          Refer to the chapter "Flow Control" for a discussion  of  hardware
  1587.          flow control.
  1588.  
  1589.          TERM  can also exchange files using ASCII (with XON/XOFF), XMODEM,
  1590.          YMODEM (batch capability), and  YMODEM-G  (streaming  YMODEM  used
  1591.          with  error correcting modems) communications protocols.  TERM can
  1592.          accept wildcards in the filename so that  multiple  files  can  be
  1593.          sent  using  YMODEM and YMODEM-G.  The protocol timing can also be
  1594.          adjusted (this should not be necessary) by modifying the constants
  1595.          SHORT_WAIT and LONG_WAIT in the TERM.CFG file.
  1596.  
  1597.          TERM  can also be used as a PC to PC transfer program using a null
  1598.          modem cable. In  this  case,  AT_COMMAND_SET  and  RTS_CTS_CONTROL
  1599.          should be defined to be FALSE in the file TERM.CFG:
  1600.  
  1601.             #define AT_COMMAND_SET  0
  1602.             #define RTS_CTS_CONTROL 0
  1603.  
  1604.          Be  advised  that  most  null modem cables are do NOT swap RTS and
  1605.          CTS, which is necessary for hardware flow control. This means that
  1606.          RTS_CTS_CONTROL should never be set to 1 (TRUE) when using a  null
  1607.          modem  cable  unless  you are absolutely sure that RTS and CTS are
  1608.          swapped.
  1609.  
  1610.          To start TERM, type TERM followed by the port (1  to  4)  and  the
  1611.          baud  rate (300, 600, 1200, 2400, 4800, 9600, 19200, 38400, 57600,
  1612.          or 115200). For example, to start TERM at 2400 baud on port COM4:
  1613.  
  1614.             TERM 4 2400
  1615.  
  1616.          The TERM program (but of course not the library itself) is  placed
  1617.          in  the  public domain by MarshallSoft Computing, Inc., and can be
  1618.          used in any way desired by the user.
  1619.  
  1620.         PCL4C Users Manual                                     Page 27
  1621.          8.0 Legal Issues
  1622.  
  1623.          8.1 Registration
  1624.  
  1625.  
  1626.          If you wish to register the PCL4C library, please send $55 plus $3
  1627.          S&H ($6 outside of North America) to:
  1628.  
  1629.                   MarshallSoft Computing, Inc.
  1630.                   Post Office Box  4543
  1631.                   Huntsville AL 35815
  1632.  
  1633.          Multiple copies are available: $45 for 3 to 9, $35 for 10  to  19,
  1634.          and  $25 for 20 or more. A site license is also available for $495
  1635.          (includes 5 sets of printed documentation). We pay shipping.
  1636.  
  1637.          We accept  American  Express  (account  number,  expiration  date,
  1638.          exact  name  on  your  card,  and  complete  AmEx  billing address
  1639.          required), checks in US dollars  drawn  on  a  US  bank,  purchase
  1640.          orders  (POs)  from  recognized US schools and companies listed in
  1641.          Dun &  Bradstreet,  and  COD  (street  address  and  phone  number
  1642.          required)  within  the USA (plus a $3 COD charge).  Print the file
  1643.          PCL4C.INV if an invoice is needed.
  1644.  
  1645.          You can also order PCL4C from The Public  Software  Library  (PSL)
  1646.          with your MC, Visa, AmEx, or Discover card by calling 800-242-4PSL
  1647.          (from  overseas:  713-524-6394)  or  by  FAX at 713-524-6398 or by
  1648.          CompuServe at [71355,470].  THESE NUMBERS ARE FOR  ORDERING  ONLY.
  1649.          The product number for PCL4C is 10908.
  1650.  
  1651.          If  you  wish  to  update from an older version of PCL4C, send $15
  1652.          plus $3 S&H ($6  outside  of  North  America).   Updates  must  be
  1653.          ordered directly from MarshallSoft Computing.
  1654.  
  1655.          The registered package includes:
  1656.  
  1657.          o  Small,Compact,Medium, & Large libs w/o shareware screens.
  1658.          o  Assembler source code for the library.
  1659.          o  Laser printed Users and Reference Manuals.
  1660.          o  Telephone, FAX, and BBS support for one year.
  1661.          o  EXAMPORT  -- Free utility which displays a detailed  formatted
  1662.             report  for  any serial port.  For example, to display a report
  1663.             for COM1, type "EXAMPORT 1".
  1664.  
  1665.          Print  the  file PCL4C.INV if an invoice is needed. The registered
  1666.          user will receive the latest version of PCL4C shipped by  two  day
  1667.          priority  mail  (packet  airmail  overseas).   A 5.25" diskette is
  1668.          provided unless a 3.5" diskette is requested.
  1669.  
  1670.  
  1671.          8.2 Referral Program
  1672.  
  1673.  
  1674.          The  registered  user  will  receive  a $5 certificate towards any
  1675.          MarshallSoft  Computing  product  by  referring  a  new   customer
  1676.          (someone who has never registered with us).  The new customer must
  1677.          identify you at the time the full price order is placed.  You will
  1678.          be mailed a $5 certificate when the new registration is paid.
  1679.  
  1680.         PCL4C Users Manual                                     Page 28
  1681.          8.3 License
  1682.  
  1683.  
  1684.          MarshallSoft  Computing,  Inc. grants the registered user of PCL4C
  1685.          the right to use one copy of the PCL4C library (in object form) on
  1686.          a single computer in  the  development  of  any  software  product
  1687.          (other  than  libraries  such as PCL4C).  The user may not use the
  1688.          library on more than one computer at the same  time.   The  source
  1689.          code  for  the  library (PCL4C.ASM) is copyrighted by MarshallSoft
  1690.          Computing and may not be released in whole or in  part.   Products
  1691.          developed using PCL4C may be distributed without any royalty.
  1692.  
  1693.  
  1694.          8.4 Warranty
  1695.  
  1696.  
  1697.          MARSHALLSOFT  COMPUTING, INC. DISCLAIMS ALL WARRANTIES RELATING TO
  1698.          THIS SOFTWARE, WHETHER EXPRESSED OR  IMPLIED,  INCLUDING  BUT  NOT
  1699.          LIMITED  TO  ANY IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
  1700.          FOR A PARTICULAR PURPOSE, AND ALL SUCH  WARRANTIES  ARE  EXPRESSLY
  1701.          AND  SPECIFICALLY DISCLAIMED. NEITHER MARSHALLSOFT COMPUTING, INC.
  1702.          NOR ANYONE ELSE WHO HAS BEEN INVOLVED IN THE CREATION, PRODUCTION,
  1703.          OR DELIVERY OF THIS SOFTWARE SHALL BE  LIABLE  FOR  ANY  INDIRECT,
  1704.          CONSEQUENTIAL,  OR  INCIDENTAL  DAMAGES  ARISING OUT OF THE USE OR
  1705.          INABILITY TO USE SUCH SOFTWARE  EVEN  IF  MARSHALLSOFT  COMPUTING,
  1706.          INC.   HAS  BEEN  ADVISED  OF  THE  POSSIBILITY OF SUCH DAMAGES OR
  1707.          CLAIMS. IN NO EVENT SHALL MARSHALLSOFT COMPUTING, INC.'S LIABILITY
  1708.          FOR ANY SUCH DAMAGES EVER EXCEED THE PRICE PAID FOR THE LICENSE TO
  1709.          USE THE SOFTWARE, REGARDLESS OF THE FORM OF THE CLAIM. THE  PERSON
  1710.          USING   THE  SOFTWARE  BEARS  ALL  RISK  AS  TO  THE  QUALITY  AND
  1711.          PERFORMANCE OF THE SOFTWARE.
  1712.  
  1713.          Some  states  do not allow the exclusion of the limit of liability
  1714.          for consequential or incidental damages, so the  above  limitation
  1715.          may not apply to you.
  1716.  
  1717.          This  agreement  shall  be  governed  by  the laws of the State of
  1718.          Alabama and shall inure to the benefit of Marshallsoft  Computing,
  1719.          Inc.   and  any successors, administrators, heirs and assigns. Any
  1720.          action or proceeding brought by either  party  against  the  other
  1721.          arising  out of or related to this agreement shall be brought only
  1722.          in a STATE or FEDERAL COURT of competent jurisdiction  located  in
  1723.          Madison County, Alabama. The parties hereby consent to in personam
  1724.          jurisdiction of said courts.
  1725.  
  1726.  
  1727.  
  1728.  
  1729.  
  1730.  
  1731.  
  1732.  
  1733.  
  1734.  
  1735.  
  1736.  
  1737.  
  1738.  
  1739.  
  1740.         PCL4C Users Manual                                     Page 29
  1741.          9.0 Summary
  1742.  
  1743.  
  1744.          9.1 Revision History
  1745.  
  1746.  
  1747.          Version 1.0 -- 14 January 1991 -- original release.
  1748.  
  1749.          Version 1.1 -- 11 March 1991
  1750.  
  1751.          o  Added SioUnGetc() function to library.
  1752.  
  1753.          Version 1.2 -- 1 June 1991
  1754.  
  1755.          o  SioParms() bug -- could not call before SioReset.
  1756.          o  SioReset() bug -- was not saving & restoring all regs.
  1757.  
  1758.          Version 1.3 -- 1 July 1991
  1759.  
  1760.          o  Added NORESET option to SioReset.
  1761.          o  Added SioDSR, SioCTS, SioDCD, SioLoopBack, and SioRI.
  1762.  
  1763.          Version 2.0 -- 1 Nov 1991
  1764.  
  1765.          o  Reorganized as four memory model libraries.
  1766.          o  Added SioModel function to library.
  1767.          o  Added support for Quick C and Power C.
  1768.  
  1769.          Version 2.1 -- 1 Dec 1991
  1770.  
  1771.          o  Fixed bug due to Microsoft Assembler (MASM 5.0,5.1) error.
  1772.  
  1773.          NOTE:  MarshallSoft incorporated as "MarshallSoft Computing, Inc."
  1774.          on December 23rd, 1991.
  1775.  
  1776.          Version 3.0 -- 15 Jan 1992
  1777.  
  1778.          o  Added SioUART function.
  1779.          o  Added "UART undefined" error code.
  1780.          o  Added "Bad or missing UART" error code.
  1781.          o  Added "Port already enabled" error code.
  1782.          o  Added "Cannot enable both COM1 & COM3 ..." error code.
  1783.          o  Fixed several minor bugs (using new automated testing).
  1784.  
  1785.          Version 3.1 -- 1 March 1992
  1786.  
  1787.          o  Added SioFIFO (INS16550 support).
  1788.          o  Added SioIRQ function.
  1789.          o  Increased maximum receive buffer size to 32K bytes.
  1790.  
  1791.  
  1792.  
  1793.  
  1794.  
  1795.  
  1796.  
  1797.  
  1798.  
  1799.  
  1800.         PCL4C Users Manual                                     Page 30
  1801.          9.1 Revision History (continued)
  1802.  
  1803.  
  1804.          Version 3.2 -- 1 May 1992
  1805.  
  1806.  
  1807.          o  Modified SioReset so that it no longer clears DTR & RTS.
  1808.          o  Modified SioModel & renamed to SioInfo.
  1809.          o  Fixed bug in SioDone when using 2 ports simultaneously.
  1810.          o  Added SioFlow to library.
  1811.          o  Added YMODEM-G protocol to TERM program.
  1812.  
  1813.          Version 3.3 -- 3 August 1992
  1814.  
  1815.          o  Fixed bug in SioUnGet when using 2 ports simultaneously.
  1816.          o  Add SioRead function.
  1817.  
  1818.          Version 3.4 -- 4 Jan 1993
  1819.  
  1820.          o  Library modified to use up to four ports simultaneously.
  1821.          o  SioIRQ was modified to include a third argument.
  1822.          o  EXAMPORT utility distributed to registered users.
  1823.  
  1824.          Version 3.5 -- 15 May 1993
  1825.  
  1826.          o  Supports DigiBoard PC/4 and PC/8.
  1827.          o  Two new error traps added ("No such IRQ" & "No such ISR").
  1828.          o  ASCII file transfer protocol added to TERM (with XON/XOFF).
  1829.  
  1830.          Version 4.0 -- 18 Oct 1993
  1831.  
  1832.          o  The library supports transmitter interrupts.
  1833.          o  Corrects bug in Ver 3.5 requiring calling SioIRQ for COM3/4.
  1834.          o  All example code compiles with supported C++ compilers.
  1835.          o  The SioIRQ() function has been simplified.
  1836.  
  1837.  
  1838.  
  1839.  
  1840.  
  1841.  
  1842.  
  1843.  
  1844.  
  1845.  
  1846.  
  1847.  
  1848.  
  1849.  
  1850.  
  1851.  
  1852.  
  1853.  
  1854.  
  1855.  
  1856.  
  1857.  
  1858.  
  1859.  
  1860.         PCL4C Users Manual                                     Page 31
  1861.          9.2 Function Summary
  1862.  
  1863.  
  1864.          Refer to the  PCL4C  Reference  Manual  (PCL4C.REF)  for  detailed
  1865.          information  on  the  communications  and support functions. A one
  1866.          line summary of each function follows:
  1867.  
  1868.  
  1869.          SioBaud     Sets the baud rate of the selected port.
  1870.          SioBrkKey   Returns non-zero if the Control-BREAK key was pressed.
  1871.          SioBrkSig   Asserts, cancels, or detects BREAK signal.
  1872.          SioCrtWrite Write character to the screen.
  1873.          SioCTS      Reads the Clear to Send (CTS) modem status bit.
  1874.          SioDCD      Reads the Data Carrier Detect (DCD) modem status bit.
  1875.          SioDelay    Delays one or more tics (18 tics per second).
  1876.          SioDone     Terminates further serial processing.
  1877.          SioDSR      Reads the Data Set Ready (DSR) modem status bit.
  1878.          SioDTR      Set, clear, or read the Data Terminal Ready (DTR) bit.
  1879.          SioError    Displays error in text.
  1880.          SioFIFO     Sets the interrupt level for the INS16550.
  1881.          SioFlow     Enables / disables hardware flow control.
  1882.          SioGetc     Reads the next character from the serial line.
  1883.          SioKeyPress Detects if keyboard has been pressed.
  1884.          SioKeyRead  Reads the keyboard.
  1885.          SioInfo     Returns library version number & memory model.
  1886.          SioIRQ      Assigns an IRQ line to a port.
  1887.          SioLine     Reads the line status register.
  1888.          SioLoopBack Performs a UART loopback test.
  1889.          SioModem    Reads the modem status register.
  1890.          SioParms    Sets parity, stop bits, and word length.
  1891.          SioPorts    Sets # ports, 1st DigiBoard port & status register.
  1892.          SioPutc     Transmit a character over a serial line.
  1893.          SioRead     Reads any of 7 UART ports.
  1894.          SioReset    Initialize a serial port for processing.
  1895.          SioRI       Reads the Ring Indicator (RI) modem status bit.
  1896.          SioRTS      Sets, clears, or reads the Request to Send (RTS) line.
  1897.          SioRxBuf    Sets up receive buffer.
  1898.          SioRxFlush  Flushes (clears) the receive buffer.
  1899.          SioRxQue    Returns the number of characters in the receive queue.
  1900.          SioTimer    Returns the number of system clock tics.
  1901.          SioTxBuf    Sets up transmit buffer.
  1902.          SioTxFlush  Flushes (clears) the transmit buffer.
  1903.          SioTxQue    Returns the number of characters in the transmit queue.
  1904.          SioUART     Sets the UART base address.
  1905.          SioUnGetc   "Un-gets" (puts back) a specified character.
  1906.  
  1907.  
  1908.          9.3 Further Reading
  1909.  
  1910.  
  1911.          The best way to learn about serial communications  is  to  read  a
  1912.          good  book  on the subject. Several good texts are available.  Two
  1913.          that I like are:
  1914.  
  1915.          (1) C Programmers's Guide to Serial Communications by Joe Campbell
  1916.          (SAMS)
  1917.          (2) Mastering Serial Communications by Peter Gofton (SYBEX).
  1918.  
  1919.  
  1920.         PCL4C Users Manual                                     Page 32
  1921.          10.0 Other MarshallSoft Computing Products
  1922.  
  1923.          10.1 The Personal Protocol Library for C
  1924.  
  1925.          The  Personal  Protocol  Library for C (PPL4C) consists of a state
  1926.          driven C language library  which  implements  XMODEM,  XMODEM-CRC,
  1927.          XMODEM-1K, XMODEM-G, YMODEM, and YMODEM-G file transfer protocols.
  1928.          This  allows  the  communications  application  to  run four ports
  1929.          simultaneously while interacting with the user  at  the  keyboard.
  1930.          The  state driven library functionally emulates background tasking
  1931.          of protocols with standard MSDOS.
  1932.  
  1933.          The primary application area for the protocol library  is  in  the
  1934.          development  of custom BBS programs (and programs that call BBS's)
  1935.          which  require  either  multiple  lines  or  which  require   user
  1936.          interaction  while  a  file transfer is underway. The state driven
  1937.          architecture can  also  be  used  as  a  framework  and  guide  to
  1938.          developing customized file transfer protocols.
  1939.  
  1940.          The protocol library (PPL4C) requires the C communications library
  1941.          PCL4C.   The  PPL4C  comes  with fully commented C source code, an
  1942.          example  program  which  can  transmit  or   receive   two   files
  1943.          simultaneously,  printed documentation, and one year of telephone,
  1944.          FAX, and BBS support.
  1945.  
  1946.          The Personal Protocol Library for C is available for $35  plus  $3
  1947.          S&H ($6 S&H overseas).  It can also be ordered together with the C
  1948.          communications  library  for  $75  for  both,  plus  $3.50 S&H ($7
  1949.          overseas).
  1950.  
  1951.          10.2 The LZW Data Compression Library for C
  1952.  
  1953.          LZW4C is an implementation of the LZW (Lempel-Ziv-Welch) algorithm
  1954.          for compressing and decompressing  data.   LZW  does  particularly
  1955.          well on text files, achieving better than a 50 % compression ratio
  1956.          for many files.
  1957.  
  1958.          The  LZW  algorithm  is  considered  to be one of the best general
  1959.          purpose algorithms available today.  The  new  high  speed  modems
  1960.          that  employ  on-the-fly  data  compression (such as MNP 5.0 & the
  1961.          V.42 bis international standard) use the LZW algorithm, as well as
  1962.          such well known utility programs such as PKZIP.
  1963.  
  1964.          The  LZW  Data Compression Library for C is available for $35 plus
  1965.          $3 S&H ($6 S&H overseas).
  1966.  
  1967.  
  1968.  
  1969.  
  1970.  
  1971.  
  1972.  
  1973.  
  1974.  
  1975.  
  1976.  
  1977.  
  1978.  
  1979.  
  1980.         PCL4C Users Manual                                     Page 33
  1981.          10.3 The EMS Expanded Memory Library
  1982.  
  1983.          The  EMS4C   library   implements   version   3.2   of   the   LIM
  1984.          (Lotus-Intel-Microsoft) specification for expanded memory. It will
  1985.          run with either version 3.2 or 4.0 of the LIM specification.
  1986.  
  1987.          The EMM4C library (included with the EMS4C library) is an expanded
  1988.          memory manager which allows C programmers to allocate and free EMS
  1989.          (expanded)  memory similiar to malloc() and free() in the standard
  1990.          C runtime library. Both EMM4C and EMS4C require that  your  system
  1991.          be  configured  with  expanded (EMS) memory. But, 386 & up systems
  1992.          can use extended memory as expanded memory.
  1993.  
  1994.          The EMS Expanded Memory Library for C is available for $35 plus $3
  1995.          S&H ($6 S&H overseas).
  1996.  
  1997.  
  1998.  
  1999.  
  2000.  
  2001.  
  2002.  
  2003.  
  2004.  
  2005.  
  2006.  
  2007.  
  2008.  
  2009.  
  2010.  
  2011.  
  2012.  
  2013.  
  2014.  
  2015.  
  2016.  
  2017.  
  2018.  
  2019.  
  2020.  
  2021.  
  2022.  
  2023.  
  2024.  
  2025.  
  2026.  
  2027.  
  2028.  
  2029.  
  2030.  
  2031.  
  2032.  
  2033.  
  2034.  
  2035.  
  2036.  
  2037.  
  2038.  
  2039.  
  2040.         PCL4C Users Manual                                     Page 34
  2041.